package com.exp.bookhouse.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.exp.bookhouse.mapper.IPRecordMapper;
import com.exp.bookhouse.pojo.IPRecord;
import com.exp.bookhouse.service.IPRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class IPRecordServiceImpl implements IPRecordService {


    @Autowired
    private IPRecordMapper ipRecordMapper;

    @Override
    public IPRecord queryIpByIp(String ip) {
        return ipRecordMapper.selectOne(new QueryWrapper<IPRecord>().eq("ip",ip));
    }

    @Override
    public void saveIPRecord(IPRecord record) {
        ipRecordMapper.insert(record);
    }

    @Override
    public void updateIPTime(IPRecord ipRecord) {
        ipRecordMapper.updateIPTime(ipRecord);
    }
}
